#pragma once

struct ID3DX11EffectPass;

namespace mmath
{
	struct FrustumPersp;
}

namespace mgfx
{
	typedef int TextureID;
	typedef int ShaderID;

	struct RenderingData;

	class CSM
	{
	public:
		static const uint NUM_CASCADES = 4;
		static const uint CASCADE_MAP_SIZE = 1024;

		CSM();
		~CSM();

		void render(const RenderingData & data);

		XMFLOAT4X4 Matrices[NUM_CASCADES];
		float SplitDepths[NUM_CASCADES + 1];

		TextureID AllCascadesMap;
		ShaderID mShaderShadowMap;

	private:
		void renderDirectionalShadowMapInFrustum(const RenderingData & data, const mmath::FrustumPersp & frustum, uint cascadeIndex);
	};
}